class Solution:
    def reverseBetween(self , head: ListNode, m: int, n: int) -> ListNode:
        # write code here
        L = list()
        if m == 1 and n == len(head):
            L = head[::-1]
        elif m == 1 and n < len(head):
            L = head[:n][::-1] + head[n:]
        elif m > 0 and n == len(head):
            L = head[:m-1] + head[m-1:][::-1]
        else:
            L = head[:m-1] + head[m-1:n][::-1] + head[n:]
        print("{",end='')
        print(",".join(L),end='')
        print("}")
s = input()
Lin = list()
m = n = 0
for i in range(len(s)):
    if s[i] == '}':
        Lin = s[1:i]
        m,n = map(int, s[i+2:].split(','))
        break
Solution().reverseBetween(list(map(str, Lin.split(','))), m, n)